package com.zz.hw;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main3 {
    public static void main(String[] args) {
        //a =97 z =122 A =65 Z = 90  0=48 9=57
        Scanner i = new Scanner(System.in);
        while (i.hasNextLine()){
            System.out.println(fun1(i.nextLine().trim()) );
        }
    }

    public static int fun1(String input){
        String reg1 = "\\D*[a-zA-Z][0-9]+";
        String reg2 = "[0-9]+[a-zA-Z]\\D*";
        String reg3 = "[0-9]+[a-zA-Z][0-9]+";
        Pattern p1 = Pattern.compile(reg1);
        Pattern p2 = Pattern.compile(reg2);
        Pattern p3 = Pattern.compile(reg3);
        int max = 0;
        String maxString = "";
        Matcher matcher1 = p1.matcher(input);
        while (matcher1.find()){
            String s = matcher1.group(0);
            if (s.length()>max){
                maxString = s;
                max = s.length();
            }
        }
        Matcher matcher2 = p2.matcher(input);
        while (matcher2.find()){
            String s = matcher2.group(0);
            if (s.length()>max){
                maxString = s;
                max = s.length();
            }
        }
        Matcher matcher3 = p3.matcher(input);
        while (matcher3.find()){
            String s = matcher3.group(0);
            if (s.length()>max){
                maxString = s;
                max = s.length();
            }
        }
        return max;
    }


    public static int fun(String input){
        Set<String> set = new HashSet<String>();
        char[] inputArr = input.toCharArray();
        for (int i = 0; i < inputArr.length; i++) {
            if ( 48 > inputArr[i] || inputArr[i]> 57){
                //往前寻找子串
                StringBuffer  front = new StringBuffer(String.valueOf(inputArr[i]));
                for (int j = 1; j < i ; j++) {
                    if ( 48 <= inputArr[i-j] &&  inputArr[i-j] <= 57 ){
                        front.append(String.valueOf(inputArr[i-j]));
                    }else {
                        break;
                    }
                }
                if (front.length()>1){
                    set.add(front.reverse().toString());
                }
                //往后寻找子串
                StringBuffer  back = new StringBuffer(String.valueOf(inputArr[i]));
                for (int j = i+1; j < inputArr.length; j++) {
                    if ( 48 <= inputArr[j] &&  inputArr[j] <=57){
                        back.append(String.valueOf(inputArr[j]));
                    }else {
                        break;
                    }
                }
                if (back.length()>1){
                    set.add(back.toString());
                    i = i + (back.length()-1);
                }
            }else {
                continue;
            }
        }
        int max =-1;
        for (String s:set) {
            if (s.length()>max){
                max = s.length();
            }
        }
        return  max;
    }
}
